import java.util.Stack;

public class test {
    public static void main(String[] args) {
        String s = "A man, a plan, a canal: Panama";


        StringBuffer re = new StringBuffer();
        char[] ss = s.toCharArray();


        String[] c = s.split(" ", -1);
        System.out.println(c[1]);

        for (int i = c.length - 1; i >= 0; i--) {
            re.append(c[i]);
            re.append(" ");
        }

        re.deleteCharAt(re.length() - 1);
    }
}
